{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import asyncio\n",
    "import zmq\n",
    "from zmq.asyncio import Context\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "router_url='tcp://127.0.0.1:15555'\n",
    "dealer_url='tcp://*:15555'\n",
    "url2='tcp://192.168.1.112:5555'\n",
    "#loop=asyncio.get_event_loop()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Received reply 1 [b'\\xf0\\x00\\x00\\x00']\n",
      "Received reply 2 [b'\\xf0\\x00\\x00\\x00']\n",
      "Received reply 3 [b'\\xf0\\x00\\x00\\x00']\n",
      "Received reply 4 [b'\\xf0\\x00\\x00\\x00']\n",
      "Received reply 5 [b'\\xf0\\x00\\x00\\x00']\n",
      "Received reply 6 [b'\\xf0\\x00\\x00\\x00']\n",
      "Received reply 7 [b'\\xf0\\x00\\x00\\x00']\n",
      "Received reply 8 [b'\\xf0\\x00\\x00\\x00']\n",
      "Received reply 9 [b'\\xf0\\x00\\x00\\x00']\n",
      "Received reply 10 [b'\\xf0\\x00\\x00\\x00']\n"
     ]
    }
   ],
   "source": [
    "#client\n",
    "import zmq\n",
    "\n",
    "#  Prepare our context and sockets\n",
    "context = zmq.Context()\n",
    "socket = context.socket(zmq.REQ)\n",
    "socket.connect(\"tcp://localhost:5559\")\n",
    "\n",
    "#  Do 10 requests, waiting each time for a response\n",
    "for request in range(1,11):\n",
    "    socket.send(b\"Hello\")\n",
    "    message = socket.recv()\n",
    "    print(\"Received reply %s [%s]\" % (request, message))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## router -dealer pyxoy\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# display"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
